package com.yesep.learn.design.behavioral.memento;

import java.util.*;

/**
 * 管理者只能看到窄接口，不允许修改备忘录对象
 */
public class Caretaker {

    private final List<IMemento> history = new LinkedList<>();

    public void push(IMemento memento) {
        history.add(memento);
    }

    public IMemento pop() {
        return history.isEmpty() ? null : history.remove(history.size() - 1);
    }
}
